package top.loonglove.common.base.controller;

import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;
import top.loonglove.common.base.query.BasePageQuery;
import top.loonglove.common.base.query.BaseQuery;
import top.loonglove.common.util.http.HttpRequest;
import top.loonglove.common.util.http.HttpResponse;

/**
 * @author : xgl
 * @version : 0.0.1
 * @date :2021/7/26 4:33
 */
@Api(tags = "首页")
@RestController
@RequestMapping("/base")
public abstract class BaseController<T,Q extends BaseQuery> {
    /**
     * 获取资源
     * @param request REQUEST
     * @return GET
     */
    @GetMapping
    public abstract HttpResponse get(HttpRequest<T,Q> request);

    /**
     * 获取资源
     * @param request REQUEST
     * @return GET
     */
    @GetMapping("/page")
    public abstract HttpResponse page(HttpRequest<T,BasePageQuery> request);

    /**
     * 获取资源
     * @param request REQUEST
     * @return POST
     */
    @PostMapping
    public abstract HttpResponse add(HttpRequest<T,Q> request);
    /**
     * 获取资源
     * @param request REQUEST
     * @return UPDATE
     */
    @PutMapping
    public abstract HttpResponse modify(HttpRequest<T,Q> request);
    /**
     * 获取资源
     * @param request REQUEST
     * @return DELETE
     */
    @DeleteMapping
    public abstract HttpResponse remove(HttpRequest<T,Q> request);

    /**
     * 获取资源
     * @param request REQUEST
     * @return DELETE
     */
    @Deprecated
    @DeleteMapping("delete")
    public abstract HttpResponse delete(HttpRequest<T,Q> request);


}
